<?php
namespace app\common\model;

use app\common\logic\AppLogic;

class AppModel extends CommonModel{
    protected  $name = 'app';
    protected  $pk   = 'app_id';

    protected $type=[
        'sku'=>'array'
    ];

    public function setWhiteListAttr($value)
    {
        return implode(',',$value);
    }

    public function getWhiteListAttr($value)
    {
        $white_list=explode(',',$value);
        foreach ($white_list as $k => $v){
            $white_list[$k]= (int) $v;
        }
        return $white_list;
    }

    public function getTypeNameAttr($value,$data)
    {
        return AppLogic::getTypeName($data['type']);
    }
}
